<?php
/* SVN FILE: $Id$ */

/**
 * Enter description here ....
 *
 * @filesource
 * @copyright    Copyright (c) 2006, .
 * @link
 * @package
 * @subpackage
 * @since
 * @version      $Revision$
 * @modifiedby   $LastChangedBy$
 * @lastmodified $Date$
 * @license      http://www.opensource.org/licenses/mit-license.php The MIT License
 */

/**
 * Senhas
 *
 * Enter description here...
 *
 * @package
 * @subpackage
 * @since
 */
class Senhas extends AppModel
{
    var $name = 'Senhas';
    var $useTable = 'senhas';
    var $primaryKey = 'co_senha';
	
    var $belongsTo  = array(

	    'Computadores' =>
		    array('className'  => 'Computadores',
			    'conditions' => '',
			    'order'      => '',
			    'foreignKey' => 'co_computador'
		    )
    );
    
    function relatorio( $dtIni , $dtFim )
    {
		$SQL = "SELECT
					count(s.dt_alteracao) as quantidade,
					DATE_FORMAT(s.dt_alteracao , '%d/%m/%Y' ) as data
				FROM senhas AS s
				WHERE dt_alteracao BETWEEN '$dtIni' and '$dtFim 23:59:59'
				GROUP BY DATE( dt_alteracao ) 
				ORDER BY dt_alteracao
				";
		
		return $this->query( $SQL );
    }
    
}

?>